<?php         
$db = new Database;
$auth = Auth::getAuth('current_user');
$user_id = $auth['id'];
$company_id =  $auth['company_id'];
$user_group = $auth['role'];
$user_groupType = $auth['role_type'];
$position_id = $auth['position_id'];
?>
    <div class="drag" style="position: fixed;left: 0;bottom: 0;top:0;z-index:1000;margin-top:2px;margin: 32px 0px 0px 0px;border-right: 1px solid #ddd; width: 30px; min-height: 100%;background-color: #fff;">
        <?php
        $userAvatarMessage = $db->query("SELECT * FROM tbuser WHERE online='1' and id!='$user_id' and company_id ='$company_id'","array");
        foreach($userAvatarMessage as $imageData){
            $name = $imageData['firstname'].'-'.$imageData['lastname'];
            echo "<a href=\"javascript:void(0)\" onclick=\"javascript:chatWith('".$imageData['firstname']."')\">";
            //echo "<a class='openChat'>";
        echo myAvatar($imageData['extension'],$imageData['id'],"30","30","border:1px solid #ddd;");
            echo "</a>";
            //echo '</a>';
        }
        ?>
    </div>
    <div class="body_contents">
        <div style="float: left;width: 30%;">
            <!-- Form Title -->
            <div class="titleBar">
                <div class="left">
                   <div class="titlePosition">
                        Form Titles
                   </div>
                </div>
                <div class="right align_right">
                </div>
             </div>
            <div class="Holdercontent MyRequestBox">
                <div class="top">
                    <div style="padding: 10px;margin:0px 0px 0px 10px;">
                        <?php
                            $num = 1;
                            $numrows = $db->query("select DISTINCT(f.id),f.form_title as form_title from tbform_user fu LEFT JOIN tbform f on fu.form_id=f.id WHERE f.company_id='$company_id' and f.is_active=1 and (fu.user = '$user_id' or fu.user='$user_group' or fu.user='pos_$position_id' or fu.user='allUsers') and fu.is_active=1","numrows");
                            if($numrows>0){
                                $query_forms = $db->query("select DISTINCT(f.id),f.form_title as form_title from tbform_user fu LEFT JOIN tbform f on fu.form_id=f.id WHERE f.company_id='$company_id' and f.is_active=1 and (fu.user = '$user_id' or fu.user='$user_group' or fu.user='pos_$position_id' or fu.user='allUsers') and fu.is_active=1","array");
                                ?>
                                <ul>
                                    <?php
                                    foreach($query_forms as $row_forms){
                                        ?>
                                        <li style="cursor: pointer;" class="formGettitle" id="formGettitle<?php echo $row_forms['id']; ?>">
                                            <?php echo $row_forms['form_title']; ?>
                                        </li>
                                        <?php
                                        $num++;
                                    }
                                    ?>
                                </ul>
                            <?php
                            }else{
                                echo "No Forms Found";
                            }
                        ?>
                    </div>
                </div>
                <div class="down">
                   
                </div>
            </div>
        </div>
        <div style="float: left;width: 68.5%;margin-bottom: 10px;margin-left: 10px;">
            <div class="titleBar">
                <div class="left">
                   <div class="titlePosition">
                        Form View
                   </div>
                </div>
                <div class="right align_right">
                </div>
             </div>
            <div class="Holdercontent MyRequestBox">
                <div class="top formView">
                
                </div>
            </div>
            
        </div>
    </div>
    <script>
        setActivNav("form_usage");
    </script>